Skip to content

Preserve call arguments across escaping jumps - #664

Open
jogibear9988 wants to merge 1 commit into
dadhi:masterfrom
jogibear9988:fix/escaping-jump-arguments-20261114
Open

jogibear9988 wants to merge 1 commit into
dadhi:masterfrom
jogibear9988:fix/escaping-jump-arguments-20261114

Conversation

@jogibear9988

@jogibear9988 jogibear9988 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Track jumps while collecting call, constructor and delegate arguments. Spill pending operands before an argument can jump away, including jumps nested inside inlined invocations.

Tests cover evaluation traces, nested invocations, constructor/method/delegate calls and genuine ref aliases.

Validation

Full Release solution build and Standard/LightExpression native runners pass for net8.0, net10.0 and net472. net8.0: 694 TestX and 1744 legacy cases; net10.0: 694 TestX and 1745 legacy cases; net472: 675 TestX and 1610 legacy cases.

Measurements

FEC on master da14580f10fd19ae2361a8e91cfad4b2dfec182a → this change 30aee00f8858a182d5495a62aee9876fdbac704a. Windows ARM64; .NET 8.0.28 and 10.0.9; SDK 10.0.301.

Trees, API conversions and invocation adapters are built before measurement. Compilation includes delegate creation; runtime measures the compiled delegate through the same adapter. Both sides are FEC: “System trees” names the expression API, not the System compiler.

Two opposite-load-order process rounds; seven alternating paired samples per round; medians of 14 samples, 100 ms calibration target. Verified task-local runtimes; tiered compilation disabled; each process pinned to one logical CPU. Allocations use GC.GetAllocatedBytesForCurrentThread. Slower observations are retained. Timing variation, including unchanged IL controls, prevents a blanket speedup or no-regression claim.

Runtime / API Workload Compile μs, master → patch Compile B/op Runtime ns, master → patch Runtime B/op
net10.0 / LightExpression constructor_arguments 8.924 → 8.078 904.0 14.547 → 8.991 32.0
net10.0 / LightExpression delegate_invoke 11.003 → 13.351 1000.0 5.826 → 5.276 0.0
net10.0 / LightExpression inline_lambda 10.804 → 8.948 992.0 4.799 → 5.698 0.0
net10.0 / LightExpression scalar_add 15.018 → 12.515 872.0 6.267 → 7.885 0.0
net10.0 / System trees constructor_arguments 14.146 → 16.933 944.2 78.095 → 51.877 32.0
net10.0 / System trees delegate_invoke 24.930 → 26.056 1000.0 8.829 → 10.187 0.0
net10.0 / System trees inline_lambda 36.998 → 30.118 1376.1 9.180 → 6.778 0.0
net10.0 / System trees scalar_add 20.332 → 19.549 872.1 10.714 → 11.628 0.0
net8.0 / LightExpression constructor_arguments 11.296 → 10.875 904.0 53.320 → 49.279 32.0
net8.0 / LightExpression delegate_invoke 16.954 → 18.210 1000.0 10.856 → 9.480 0.0
net8.0 / LightExpression inline_lambda 14.659 → 13.364 992.1 7.222 → 5.791 0.0
net8.0 / LightExpression scalar_add 9.778 → 12.232 872.0 8.358 → 9.479 0.0
net8.0 / System trees constructor_arguments 30.294 → 19.746 944.2 47.503 → 51.889 32.0
net8.0 / System trees delegate_invoke 45.677 → 45.703 1000.0 9.813 → 9.621 0.0
net8.0 / System trees inline_lambda 30.458 → 43.669 1432.1 8.179 → 9.856 0.0
net8.0 / System trees scalar_add 13.463 → 14.643 872.1 11.323 → 10.079 0.0

Shared-workload emitted IL is unchanged.

Allocation changes: none beyond measurement rounding in these shared workloads.

Affected cases without a valid master baseline

Master rejects these trees or generates a delegate with incorrect behavior, so they are excluded from comparative timings. Patch-only measurements use 14 samples, a 30 ms calibration target, and the same compilation/runtime separation. fixed_case exercises this PR’s added behavior.

Runtime / API Case Compile μs Compile B/op Runtime ns Runtime B/op
net10.0 / LightExpression fixed_case 13.312 1336.2 9.879 0.0
net10.0 / System trees fixed_case 4.701 1336.3 8.695 0.0
net8.0 / LightExpression fixed_case 8.358 1336.1 7.750 0.0
net8.0 / System trees fixed_case 14.001 1336.1 14.904 0.0

Track jumps while collecting call, constructor and delegate arguments. Spill pending operands before an argument can jump away, including jumps nested inside inlined invocations.

Tests cover evaluation traces, nested invocations, constructor/method/delegate calls and genuine ref aliases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant